<template>
    <div class="item_list">
        <van-nav-bar
                title="我的足迹"
                left-arrow
                @click-left="$router.push({name:'user'})"
        />
        <van-list v-model="loading"
                  :finished="finished"
                  :immediate-check="false"
                  finished-text="没有更多了"
                  @load="getGoodsList">
            <div class="h" v-bind:style="{ backgroundImage: 'url('+currentCategory.picUrl+')' }">
                <div class="name">{{currentCategory.name}}</div>
                <div class="desc">{{currentCategory.desc}}</div>
            </div>

            <van-row>
                <van-col span="12" v-for="(item, i) in goodsList"
                >
                    <div style=" padding:3px">
                        <div
                                :key="i"
                                style=" border-radius: 5px; background-color:#fff; overflow: hidden;padding: 5px"
                        >
                            <router-link :to="{ path: `/items/detail/${item.id}`}">
                                <img :src="item.picUrl" style="width: 100%;"/>
                                <p style="font-size: 12px; color: #999999; padding: 10px 0px 5px 10px;overflow: hidden;text-overflow:ellipsis;white-space: nowrap">
                                    {{item.name}}</p>
                                <div style="padding:15px 0px 0px 10px;position: relative;bottom: 10px; color:#000; font-size: 13px;overflow: hidden;text-overflow:ellipsis;white-space: nowrap">
                                    ￥{{item.retailPrice}}
                                    <span>+{{item.modelPrice}}</span>
                                    <s style="color:#cccccc;float: right;position: relative;right: 1px;font-size: 12px">原价￥{{item.counterPrice}}</s>
                                </div>
                            </router-link>
                        </div>
                    </div>
                </van-col>
            </van-row>
        </van-list>
    </div>
</template>

<script>
    import {footprintList, goodsList} from '@/api/api'
    import {cashinfo} from "@/api/api";

    export default {
        name: "foodprint",
        data() {
            return {
                categoryId: this.itemClass,
                goodsList: [],
                page: 0,
                limit: 10,
                currentCategory: {},
                loading: false,
                finished: false
            }
        },
        created(){
           this.getGoodsList()
        },
        methods:{
            getGoodsList() {
                this.page++;
                footprintList({
                    page: this.page,
                    limit: this.limit
                }).then(res => {
                    console.log(res)
                    this.goodsList.push(...res.data.data.list);
                    this.loading = false;
                    this.finished = res.data.data.page >= res.data.data.pages;
                });
            },
        }
    }
</script>

<style scoped>

</style>